<%@ include file="/en/jsp/static.jsp" %>
<%@ page import="linuxbox.util.*" %>

<%
  Map modules = BoxStatic.mainConfig.getHomePageModules();

  String TOP_PANE = null;
  String tmp = sec.getConfigString("home", "General", "Top Pane");
  if (tmp.length() > 0)
  {
    TOP_PANE = (String)modules.get(tmp);
  }

  String BOTTOM_PANE = null;
  tmp = sec.getConfigString("home", "General", "Bottom Pane");
  if (tmp.length() > 0)
  {
    BOTTOM_PANE = (String)modules.get(tmp);
  }

  int COLUMNS = 2;
  tmp = sec.getConfigString("home", "General", "Columns");
  if (tmp != null && tmp.length() > 0)
  {
    COLUMNS = Integer.parseInt(tmp);
  }

  String[][] cols = new String[3][];

  cols[0] = sec.getConfigStrings("home", "General", "Column1");
  cols[1] = sec.getConfigStrings("home", "General", "Column2");
  cols[2] = sec.getConfigStrings("home", "General", "Column3");

%>

<table width="100%" height=26 align=middle border=0 cellpadding=0 cellspacing=0 bgcolor="#f4f4f4" style="font-size:16px;color:#d05000">
  <tr>
    <td>
      &nbsp;<img src="<%=BoxStatic.imageDir%>itemball.jpg" width=14 height=15 border=0 align="absmiddle">
      <b><%=boxName%> - My Net.O.Box</b>
    </td>
    <td align=right>
      <a href="<%=BoxStatic.servletDir%>BoxHomeSettingsAction?SubmitEdit=edit">
        Settings
      </a>
    </td>
  </tr>
</table>
<hr width="100%" color=#E06000 align=left>

<table width="100%" border=0 cellpadding=1 cellspacing=1>
<%
  if (TOP_PANE != null && TOP_PANE.length() > 0)
  {
    out.print("<tr><td valign=top colspan= ");
    out.print(COLUMNS);
    out.print(">");

%>
    <jsp:include page="<%=TOP_PANE%>" flush="true" />
<%
    out.print("</td></tr>");
  }

  out.print("<tr>");

  //each column is a table
  for(int col=0; col < COLUMNS; col++)
  {
    String[] COLUMN = cols[col];

    if (COLUMN != null)
    {
      out.print("<td valign=top><table width=100% >");
      for(int i=0; i < COLUMN.length; i++)
      {
        out.print("<tr>");
        if ( COLUMN[i] != null)
        {
          tmp = (String)modules.get(COLUMN[i]);
          if (tmp != null && tmp.length() > 0)
          {
  %>
          <td valign=top>
          <!-- Begin Module Page: <%=tmp%> -->
            <jsp:include page="<%=tmp%>" flush="true" />
          <!-- End Module Page: <%=tmp%>-->
          </td>
  <%
          }
          else
          {
            out.print("<td>No page" + tmp + "</td>");
          }
        }
        else
        {
          out.print("<td>No page defined</td>");
        }
        out.print("</tr>");
      }
      out.print("</table></td>");
    }
  }
  out.print("</tr>");


  if (BOTTOM_PANE != null && BOTTOM_PANE.length() > 0)
  {
    out.print("<tr><td valign=top colspan= ");
    out.print(COLUMNS);
    out.print(">");

%>
        <jsp:include page="<%=BOTTOM_PANE%>" flush="true" />
<%
    out.print("</td></tr>");
  }
%>
</table>
<hr width=\"100%\" color=#E06000 align=left>
